package PenTest.meituan241027.acm2;

import java.math.BigDecimal;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
//        "3" + "a12b03c3d0"
        int k = in.nextInt();
        // 注意 hasNext 和 hasNextLine 的区别
        String s = in.next();
//        for (int i = 0; i < s.length(); i++) {
//            System.out.println(s.charAt(i)-'0');
//        }
        List<BigDecimal> list = construct(s);
        list.sort(new Comparator<BigDecimal>() {
            @Override
            public int compare(BigDecimal o1, BigDecimal o2) {
                return -o1.compareTo(o2);
            }
        });
        if (k > list.size()) {
            System.out.println('N');
        } else {
            System.out.println(list.get(k - 1));
        }
    }

    private static List<BigDecimal> construct(String s) {
        List<BigDecimal> list = new ArrayList<>();
        int i = 0;
//        int j=0;
        StringBuilder sb = new StringBuilder();
        while (i < s.length()) {
            if (s.charAt(i) - '0' < 10) {
                sb.append(s.charAt(i) - '0');
            } else {
                if (sb.length() != 0) {
                    list.add(new BigDecimal(sb.toString()));
                    sb = new StringBuilder();
                }
            }
            i++;
        }
        if (sb.length() != 0) {
            list.add(new BigDecimal(sb.toString()));
        }
        return list;
    }
}